#!/bin/bash
context=$1
path=$2
name=$3
logfile=$name".changelog"
# Inclusing subfolders and files
repath=$path"(/.*)?"
echo $path
echo $context
echo "old context" >> $logfile
matchpathcon $path >> $logfile
semanage fcontext -a -t $context $path
semanage fcontext -a -t $context $repath
restorecon -R $path
echo "new context" >> $logfile
matchpathcon $path >> $logfile
echo "DONE" >> $logfile
